<div>
    <div nz-row nzGutter="16">
        <div nz-col nzSpan="8">
            <div class="panel">
                <div class="panel-head">
                    科室信息
                </div>
                <div class="panel-body">
                    <form nz-form [formGroup]="validateForm">
                        <nz-form-item>
                            <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="departmentName">科室名称</nz-form-label>
                            <nz-form-control [nzSm]="14" [nzXs]="24" [(nzValidateStatus)]="validateForm.controls.departmentName">
                                <input *ngIf="!id" nz-input id="departmentName" formControlName="departmentName" placeholder="请输入科室名称" />
                                <label *ngIf="id">
                                    <span>{{validateForm.get('departmentName').value}}</span>
                                </label>
                                <nz-form-explain *ngIf="validateForm.get('departmentName')?.dirty && validateForm.get('departmentName')?.errors">科室名称不能为空！</nz-form-explain>
                            </nz-form-control>
                        </nz-form-item>
                        <nz-form-item>
                            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="departmentTypeId" nzRequired>科室类别</nz-form-label>
                            <nz-form-control [nzSm]="14" [nzXs]="24" [nzValidateStatus]="validateForm.get('departmentTypeId')">
                                <nz-select *ngIf="!id" style="width: 100%;" formControlName="departmentTypeId">
                                    <nz-option [nzValue]="item.id" [nzLabel]="item.name" *ngFor="let item of departmentTypesList"></nz-option>
                                </nz-select>
                                <label *ngIf="id">
                                        <span>{{departmentTypes[validateForm.get('departmentTypeId').value]}}</span>
                                </label>
                            </nz-form-control>
                        </nz-form-item>
                        <nz-form-item>
                            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="status" nzRequired>记录状态</nz-form-label>
                            <nz-form-control [nzSm]="14" [nzXs]="24" [nzValidateStatus]="validateForm.get('status')">
                                <nz-select style="width: 100%;" formControlName="status">
                                    <nz-option nzValue="Y" nzLabel="正常"></nz-option>
                                    <nz-option nzValue="N" nzLabel="停用"></nz-option>
                                </nz-select>
                            </nz-form-control>
                        </nz-form-item>
                        <nz-form-item>
                            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="memo">备注</nz-form-label>
                            <nz-form-control [nzSm]="14" [nzXs]="24" [nzValidateStatus]="validateForm.get('memo')">
                                <label>
                                    <span>{{validateForm.get('memo').value}}</span>
                                </label>
                            </nz-form-control>
                        </nz-form-item>
                        <nz-form-item>
                            <nz-form-control [nzOffset]="6" [nzSm]="14" [nzXs]="24" [nzValidateStatus]="validateForm.get('memo')">
                                <button nz-button nzType="primary" (click)="updateDepartment()">修改</button>
                                <button nz-button [routerLink]="['/memberCenter/administrator/department']">返回</button>
                            </nz-form-control>
                        </nz-form-item>
                    </form>
                </div>
            </div>
        </div>
        <div nz-col nzSpan="16">
            <div class="panel">
                <div class="panel-head">
                    科室权限
                </div>
                <div class="panel-body">
                    <nz-tree
                        #permissionTree
                        [nzData]="permissions"
                        nzCheckable
                        nzMultiple
                        [nzShowExpand]="false"
                        [nzExpandAll]="true"
                        [nzCheckedKeys]="selectPermission"
                        (nzCheckBoxChange)="checked($event)"
                      >
                    </nz-tree>
                    <nz-form-item>
                        <nz-form-control [nzOffset]="10" [nzSm]="14" [nzXs]="24">
                            <button nz-button nzType="primary" (click)="savePermission()">保存权限配置</button>
                        </nz-form-control>
                    </nz-form-item>
                </div>
            </div>
        </div>
    </div>
</div>